﻿@model IEnumerable<FollowPeers.Models.Job>
@{
    ViewBag.Title = "My Bookmarked Jobs";
    
       @Html.Partial("_Header")
      @Html.Partial("_SideBar5")
    
}

<div class="grid_10">
    <div class="box">
        <h2>
            My Bookmarked Jobs
        </h2>
        @if (Model.Count() == 0)
        {
            <div style="padding:10px;">You have no bookmarked Jobs.</div>
        }
            @foreach (var item in Model)
            {   <div style="height:90px">
            @{
                FollowPeers.Models.FollowPeersDBEntities followPeersDB = new FollowPeers.Models.FollowPeersDBEntities();
                FollowPeers.Models.UserProfile me = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserProfileId == item.ownerId);
                string myname = Membership.GetUser().UserName;
                FollowPeers.Models.UserProfile myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == myname);
                    }
                <div class="block" style="overflow:hidden; height:70px; width:70px;float:left; text-align: center">
                    <a href="/Profile/DetailJob/@item.JobId"><img src="@Html.Encode(me.PhotoUrl)" style="margin-left:auto; margin-right:auto; width:70px;" /></a>
                </div>
                <div style="float:left; margin: 7px 0px 0px 5px;">
                @Html.ActionLink(item.Title, "DetailJob", new {id=item.JobId}) (@Html.DisplayFor(modelitem => item.Country))
                <br />
                Posted By 
                 @if (Membership.GetUser().UserName == me.UserName)
                 {
                     @Html.ActionLink("Me", "Index", new { id = me.UserProfileId }) 
                 }
                 else
                 {
                     @Html.ActionLink(me.FirstName + " " + me.LastName, "Index", new { id = me.UserProfileId }) 
                 }
                 on @item.publishDate.ToShortDateString()
                
                <br />
                For @foreach (var s in item.Specializations)
                    {
                       <text>@s.SpecializationName </text>
                    }
                <br />
                @{int peoplebookmarked = @item.UserProfiles.Count()-1;}
                Bookmarked by @peoplebookmarked people
                </div>
                 <div id="follow" style="float:right;margin:15px;">
                 @{
                     using (Html.BeginForm("UnBookmark", "Profile", new { url = HttpContext.Current.Request.Url.AbsoluteUri }))
                     {
                        <input type="hidden" name="jobid" value="@item.JobId" />
                        <input type="submit" value="UnBookmark" style="padding: 8px 20px;color:gray;float: right;cursor: pointer;font-weight: bold;" />
                     }
                    
                 }</div>
                <div style="clear:none"></div></div>
                
                

            }
        
    </div>
</div>
<div class="grid_3">
    <div class="box">
       
    </div>
</div>
@Html.Partial("_Footer")
